package com.yogee.topseller.activity.tianyan;

import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.yogee.topseller.R;
import com.yogee.topseller.activity.base.HttpActivity;
import com.yogee.topseller.adapter.DcdyChangeInfoAdapter;
import com.yogee.topseller.adapter.DcdyDiyaAdapter;
import com.yogee.topseller.adapter.DcdyGuishuAdapter;
import com.yogee.topseller.adapter.GqczDetailAdapter;
import com.yogee.topseller.bean.DcdyBean;
import com.yogee.topseller.bean.GqczBean;
import com.yogee.topseller.layout.TitleLayout;
import com.zly.widget.CollapsedTextView;

import java.text.SimpleDateFormat;
import java.util.Date;

import butterknife.BindView;

public class DcdyDetailActivity extends HttpActivity {

    @BindView(R.id.add_card_titlelayout)
    TitleLayout titlelayout;

    @BindView(R.id.tv_value1)
    TextView tv_value1;
    @BindView(R.id.tv_value2)
    TextView tv_value2;
    @BindView(R.id.tv_value3)
    TextView tv_value3;
    @BindView(R.id.tv_value4)
    TextView tv_value4;
    @BindView(R.id.tv_value5)
    TextView tv_value5;
    @BindView(R.id.tv_value6)
    TextView tv_value6;
    @BindView(R.id.tv_value7)
    TextView tv_value7;
    @BindView(R.id.tv_value8)
    TextView tv_value8;
    @BindView(R.id.tv_value9)
    TextView tv_value9;
    @BindView(R.id.tv_value10)
    TextView tv_value10;
    @BindView(R.id.tv_value11)
    TextView tv_value11;
    @BindView(R.id.tv_value12)
    TextView tv_value12;
    @BindView(R.id.tv_value13)
    TextView tv_value13;
    @BindView(R.id.tv_value14)
    TextView tv_value14;
    @BindView(R.id.tv_value15)
    TextView tv_value15;
    @BindView(R.id.tv_value16)
    TextView tv_value16;
    @BindView(R.id.ll_beizhu)
    LinearLayout ll_beizhu;
    @BindView(R.id.tv_detail1)
    CollapsedTextView tv_detail1;
    @BindView(R.id.ll_zhuxiao)
    LinearLayout ll_zhuxiao;
    @BindView(R.id.tv_detail2)
    CollapsedTextView tv_detail2;
    @BindView(R.id.ll_gk_beizhu)
    LinearLayout ll_gk_beizhu;
    @BindView(R.id.tv_detail3)
    CollapsedTextView tv_detail3;
    //ll1
    @BindView(R.id.ll1)
    LinearLayout ll1;
    @BindView(R.id.rv_bian)
    RecyclerView rv_bian;
    @BindView(R.id.ll2)
    LinearLayout ll2;
    @BindView(R.id.rv_diya)
    RecyclerView rv_diya;
    @BindView(R.id.ll3)
    LinearLayout ll3;
    @BindView(R.id.rv_guishu)
    RecyclerView rv_guishu;

    DcdyChangeInfoAdapter changeInfoAdapter;
    DcdyDiyaAdapter diyaAdapter;
    DcdyGuishuAdapter guishuAdapter;
    DcdyBean.Item bean;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_detail_dcdy;
    }

    @Override
    protected void initView() {
        titlelayout.setActivity(this);
        titlelayout.setTitle(getIntent().getStringExtra("title"));
        bean = (DcdyBean.Item) getIntent().getSerializableExtra("info");
        rv_bian.setLayoutManager(new LinearLayoutManager(this));
        changeInfoAdapter = new DcdyChangeInfoAdapter(this);
        rv_bian.setAdapter(changeInfoAdapter);

        rv_diya.setLayoutManager(new LinearLayoutManager(this));
        diyaAdapter = new DcdyDiyaAdapter(this);
        rv_diya.setAdapter(diyaAdapter);

        rv_guishu.setLayoutManager(new LinearLayoutManager(this));
        guishuAdapter = new DcdyGuishuAdapter(this);
        rv_guishu.setAdapter(guishuAdapter);
        setInfo();
    }
    private void setInfo(){
        if(bean!=null){
            SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");

            tv_value1.setText(bean.getBaseInfo().getOverviewAmount());
            tv_value2.setText(bean.getBaseInfo().getScope());
            tv_value3.setText(bean.getBaseInfo().getStatus());
            tv_value4.setText(bean.getBaseInfo().getRegDate());
//
            tv_value6.setText(bean.getBaseInfo().getOverviewType());
            tv_value7.setText(bean.getBaseInfo().getType());
            tv_value8.setText(bean.getBaseInfo().getOverviewScope());
            tv_value9.setText(bean.getBaseInfo().getAmount());
            tv_value10.setText(bean.getBaseInfo().getOverviewTerm());
            tv_value11.setText(bean.getBaseInfo().getRegDepartment());
            tv_value12.setText(bean.getBaseInfo().getRegNum());
            tv_value13.setText(bean.getBaseInfo().getTerm());
            tv_value14.setText(bean.getBaseInfo().getBase());
            tv_value15.setText(sdf.format(new Date(Long.parseLong(String.valueOf(bean.getBaseInfo().getCancelDate())))));
            tv_value16.setText(sdf.format(new Date(Long.parseLong(String.valueOf(bean.getBaseInfo().getPublishDate())))));
//            if(TextUtils.isEmpty(bean.getBaseInfo().getRemark())){
//                ll_beizhu.setVisibility(View.GONE);
//            }else{
//                ll_zhuxiao.setVisibility(View.VISIBLE);
//                tv_detail1.setText(bean.getBaseInfo().getRemark());
//            }
//            if(TextUtils.isEmpty(bean.getBaseInfo().getCancelReason())){
//                ll_zhuxiao.setVisibility(View.GONE);
//            }else{
//                ll_zhuxiao.setVisibility(View.VISIBLE);
//                tv_detail2.setText(bean.getBaseInfo().getCancelReason());
//            }
//            if(TextUtils.isEmpty(bean.getBaseInfo().getOverviewRemark())){
//                ll_gk_beizhu.setVisibility(View.GONE);
//            }else{
//                ll_gk_beizhu.setVisibility(View.VISIBLE);
//                tv_detail3.setText(bean.getBaseInfo().getOverviewRemark());
//            }
//            if(bean.getChangeInfoList()!=null&&bean.getChangeInfoList().size()>0){
//                ll1.setVisibility(View.VISIBLE);
//                changeInfoAdapter.addData(bean.getChangeInfoList());
//            }else{
//                ll1.setVisibility(View.GONE);
//            }
//
//            if(bean.getPawnInfoList()!=null&&bean.getPawnInfoList().size()>0){
//                ll2.setVisibility(View.VISIBLE);
//                diyaAdapter.addData(bean.getPawnInfoList());
//            }else{
//                ll2.setVisibility(View.GONE);
//            }
//
//            if(bean.getPeopleInfo()!=null&&bean.getPeopleInfo().size()>0){
//                ll3.setVisibility(View.VISIBLE);
//                guishuAdapter.addData(bean.getPeopleInfo());
//            }else{
//                ll3.setVisibility(View.GONE);
//            }

        }
    }

}
